package com.mszlu.blog.admin.controller;

import com.mszlu.blog.admin.common.Result;
import com.mszlu.blog.admin.entity.Permission;
import com.mszlu.blog.admin.entity.params.PageParam;
import com.mszlu.blog.admin.service.PermissionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/admin/permission")
public class PermissionController {

    @Autowired
    private PermissionService permissionService;

    @PostMapping("/permissionList")
    public Result listPermission(@RequestBody PageParam pageParam){

        return permissionService.pageList(pageParam);
    }

    @PostMapping("/add")
    public Result add(@RequestBody Permission permission){
        return permissionService.add(permission);
    }

    @PostMapping("/update")
    public Result update(@RequestBody Permission permission){
        return permissionService.update(permission);
    }

    @GetMapping("/delete/{id}")
    public Result delete(@PathVariable("id") Long id){
        return permissionService.delete(id);
    }






}
